home *** CD-ROM | disk | FTP | other *** search
/ Directorty Opus 5 - Magellan 2 / Opus 5 - Magellan 2.iso / DOpus_Install / Core / Storage / Modules / test-command.dopus5 < prev   
Text File  |  1996-08-22  |  3KB  |  71 lines

  1. /*
  2.  
  3.    $VER: test-command.dopus5 1.1 (29.05.96)
  4.  
  5.    Example of an 'arexx module'. This program must go in the dopus5:modules
  6.    directory, and MUST have the suffix .dopus5 to work correctly.
  7.  
  8.    The script is called with 2 or more parameters. The first 2 are always
  9.    provided - the portname, and the function. For all functions other than
  10.    'init', the source and destination lister handles are also provided.
  11.    Any user-supplied arguments to the function will follow.
  12.  
  13.    Your script must provide at least the 'init' function. This is the
  14.    function that adds the commands to DOpus (see below). DOpus runs any
  15.    scripts (identified by the .dopus5 suffix) it finds in the dopus5:modules
  16.    directory automatically on startup.
  17.  
  18.    You can add as many commands as you like. To add commands, use the
  19.    'dopus command' command. The template is :
  20.  
  21.       dopus command <name> program <scriptname> desc <description> template <template> [source] [dest]
  22.  
  23.       name     = the name of the command
  24.       program  = filename of the script (without .dopus5 suffix)
  25.       desc     = optional command description (for popup command list in editors)
  26.       template = optional command template (you'll have to do parsing yourself)
  27.       source   = specify this keyword if you would like a source
  28.       dest     = specify this keyword if you would like a destination
  29.  
  30.    The program field is mandatory, and Opus will run the script name you provide here
  31.    whenever this function is invoked.
  32.  
  33.    If you specify the source or dest keywords, Opus will lock the source/destination
  34.    if available and pass you its lister handle automatically. Otherwise, if you want
  35.    a source or destination you will have to use 'lister query' and get it manually.
  36.  
  37.    The function is called with the source and destination lister handles; if there
  38.    is no source/dest these will be 0. Note that these are always provided, even if you don't
  39.    specify the appropriate keywords (they will just always be 0).
  40.  
  41. */
  42.  
  43. parse arg portname function source dest arguments
  44. address value portname
  45. options results
  46.  
  47. /* Initialise */
  48.  
  49. if function='init' then do
  50.     dopus command "Test1" program "test-command" desc "'Test command 1'" template "TEST/S" 'source dest'
  51.     dopus command "Test2" program "test-command" desc "'Test command 2'"
  52.     exit
  53.     end
  54.  
  55.  
  56. /* Test function 1 */
  57.  
  58. if function='Test1' then do
  59.     str="'Source : "||source||"  Dest : "||dest||"  Args : "||arguments||"'"
  60.     dopus request str "Ok"
  61.     exit
  62.     end
  63.  
  64.  
  65. /* Test function 2 */
  66.  
  67. if function='Test2' then do
  68.     dopus request "'Test command 2 received!'" "Ok"
  69.     exit
  70.     end
  71.